/*
 * Licensed under the License, Version 1.0 (the "License");
 * You may obtain a copy of the License at
 *   http://www.heavenick.com/license/License 
 * Copyright information Heavenick to all.
 * Unless the applicable legal requirements or written 
 * consent, can use or around the code, and no warranties 
 * of any kind and state responsibility.
 */
package com.heavenick.generator.config.xml;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.List;
import java.util.Properties;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import com.heavenick.generator.config.Configuration;

/**
 * 
 * @author Heavenick
 * @version 1.0
 * @date 2012-9-24 下午10:29:21
 */
public class ConfigurationParser {
	private List<String> warnings;
	private List<String> parseErrors;
	private Properties properties;

	public Configuration parseConfiguration(File inputFile) throws Exception {
		
		FileReader fileReader = new FileReader(inputFile);
		return parseConfiguration(fileReader);
	}
	
	public Configuration parseConfiguration(FileReader fileReader) throws Exception{
		InputSource inputSource= new InputSource(fileReader);
		return parseConfiguration(inputSource);
	}

	private Configuration parseConfiguration(InputSource inputSource) throws Exception {
		parseErrors.clear();
		DocumentBuilderFactory  documentbuilderfactory = DocumentBuilderFactory.newInstance();
		documentbuilderfactory.setValidating(true);
		
		
		DocumentBuilder builder = documentbuilderfactory.newDocumentBuilder();
//		builder.setErrorHandler(eh)
		builder.parse(inputSource);
		
		
		
		
		
		
		
		return null;
	}
}